package com.jihu.design.behavioral.template;

/**
 * @author jihu
 * @date 2021/9/27
 */
public abstract class CookTemplate {

    /**
     * 定义算法:定义好了模板
     * 父类可以实现某些步骤
     * 留关键给子类
     */
    public void cook(){
        //定义算法步骤
        heating();
        addFood();
        addSalt();
        stirfry();
        end();
    }

    public void heating(){
        System.out.println("开大火......");
    }

    //添加食物
    public abstract void addFood();

    //加盐
    public abstract void addSalt();

    //翻炒
    public void stirfry(){
        System.out.println("翻炒中......");
    }

    //出锅
    public void end(){
        System.out.println("出锅......");
    }
}
